<!DOCTYPE html>
<html>
<head>
    <title>酷炫文件上传下载</title>
    <link rel="stylesheet" href="static/css/style.css"> </head>
<body>
<form id="uploadForm" enctype="multipart/form-data">
    <input type="file" id="fileInput">
    <button type="submit">上传</button>
</form>

<ul id="fileList">
</ul>

<script src="script.js"></script> </body>
</html>
<script>
    // script.js
    const form = document.getElementById('uploadForm');
    const fileInput = document.getElementById('fileInput');
    const fileList = document.getElementById('fileList');

    form.addEventListener('submit', (event) => {
        event.preventDefault();
        // 这里添加上传文件的逻辑，可以使用FormData对象和XMLHttpRequest
        // 上传成功后，将文件名添加到列表中
        const fileName = fileInput.files[0].name;
        const listItem = document.createElement('li');
        listItem.textContent = fileName;
        fileList.appendChild(listItem);
    });
</script>